<?php

class SofiaUi extends Smarty {
	private static $Instancia;
	private $pagina;

	/**
	 * @return Controle
	 */
	private $controle;

	public static function Instanciar(){
        if(!self::$Instancia){
            self::$Instancia = new Template;
            return self::$Instancia;
        }
        return self::$Instancia;
    }

	public function SofiaUi(){
		$this->template_dir = SITE_ROOT . "shell" . DS . "html" . DS;
	    $this->compile_dir  = SITE_ROOT . "shell" . DS . "output" . DS;
	    $this->config_dir   = SITE_ROOT . "shell" . DS . "master" . DS;
	    $this->cache_dir    = SITE_ROOT . "shell" . DS . "cache" . DS;

	    $this->caching = false;
	}

	/**
	 * 
	 * @param Controle $ctrl
	 * @return SofiaUi
	 */
	public function RegistraControlador(Controle $ctrl){
		$this->controle = $ctrl;
		return $this;
	}

	public function Ajustar(){
		$tmp_array = $this->controle->GetTrocaConteudo();
		foreach($tmp_array as $tag => $valor){
			$this->assign($tag, $valor);
		}
	}
}